<template>
  <el-container class="home-container">
      <!-- 头部区域-->
      <el-header>
          <div>
              <img src="../assets/logo.png" alt=""/>
              <span></span>
          </div>
          <el-button type="info" @click="logout">退出</el-button>
    </el-header>
  </el-container>
  <el-container>
      <el-aside width="200px">
          <div></div>
      </el-aside>
      <el-main>
          <router-view></router-view>
      </el-main>
  </el-container>
  </el-container>
</template>
<script>
export default {
    data(){
        return {
            //左侧菜单数据
            menuList:[],
            iconObj:{
                
            },
            //是否折叠
            isCollapse:false,
            //被激活的链接地址
            activePath:''
        }
    },
   created(){
       this.getMenuList();
       thiis.activePath = window.sessionStorage.getItem('activePath')
   } ,
  methods: {
    logout() {
      window.sessionStorage.clear()
      this.$router.push('/login')
    },
    //获取所有菜单
    async getMenuList(){
        const {data:res} = await this.$http.get('menus');
        if(res.meta.status != '200') return this.$message.error(res.mate.msg);
        this.menuList = res.data;
        console.log(res);
    },
    toggleButton(){
        this.isCollapse  = !this.isCollapse;
    },
    saveNavState(activePath){
        window.sessionStorage.setItem('activePath',activePath);
        this.activePath = activePath;
    }
  }
}
</script>

<style lang="less" scoped>
.home-container{
    width: 100%;
}
.el-header{
    background-color: #203904;
    display: flex;
    justify-content: space-between;
    padding-left: 0;
    align-items: center;
    color: #fff;
    font-size: 20px;
    > div{
        display: flex;
        align-items: center;
        span { 
            margin-left: 15px;
        }
    }
}
.el-aside{
    background-color: blue;
}
.toggle-button{
    background-color: blueviolet;
    font-size: 10px;
    line-height: 24px;
    color: #fff;
    text-align: center;
    letter-spacing: 0.2em;

}
</style>
